/*
 * @Author: atdow
 * @Date: 2021-08-02 16:58:10
 * @LastEditors: null
 * @LastEditTime: 2021-08-09 18:07:42
 * @Description: file description
 */

import request from "@/utils/request";

// TODO 获取统计规则列表
export function getStatisticsRuleList(query) {
    return request({
        url: "/system/statistical/getStatisticalList",
        method: "get",
        params: query
    });
}
// TODO 下载统计规则列表
export function downLoadStatisticsRuleList(id) {
    return request({
        url: "/system/statistical/export/" + id,
        method: "get"
        // params: query
    });
}

// // TODO 修改统计规则列表状态
// export function editStatisticsRuleStatus(id) {
//     return request({
//         url: "/system/directory/" + id,
//         method: "get"
//     });
// }

// TODO 开启统计规则
export function openStatisticsRule(id) {
    return request({
        url: "/system/statistical/open/" + id,
        method: "get"
    });
}

// TODO 关闭统计规则
export function stopStatisticsRule(id) {
    return request({
        url: "/system/statistical/suspend/" + id,
        method: "get"
    });
}

// TODO 统计规则-手动统计
export function manualStatistics(id) {
    return request({
        // /system/statistical/statisticsTask/{id}
        url: "/system/statistical/statisticsTask/" + id,
        method: "get"
    });
}

//---------------------------详情页start------------------------------------------------

// TODO 获取统计规则详情
export function getStatisticsRuleDetail(id) {
    return request({
        url: "/system/statistical/getStatistical/" + id,
        method: "get"
    });
}

// 获取表单树
export function getFormTree() {
    return request({
        url: "/system/dir/myTree?tableShow=1",
        method: "get"
    });
}

export function getStatisticsFormList(params) {
    return request({
        url: "/system/statistical/getTableList",
        method: "post",
        data: params
    });
}

// TODO 新增或修改统计规则
export function addorChangeStatisticsRule(params) {
    return request({
        url: "/system/statistical/addOrUpdate",
        method: "post",
        data: params
    });
}

// /system/statistical/getStatisticalList/{id}

// 获取统计周期
export function getStatisticsPeriodOption() {
    return request({
        url: "/system/statistical/getStatisticsPeriodType",
        method: "get"
    });
}

// 获取统计内容
export function getStatisticsContentOption() {
    return request({
        url: "/system/statistical/getStatisticsType",
        method: "get"
    });
}

//---------------------------详情页end------------------------------------------------
